package com.createdevelopment.gaoyou;

import android.annotation.SuppressLint;
import android.app.ActionBar;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.GridView;

import com.createdevelopment.gaoyou.adapter.ImageAdapter;

@SuppressLint("NewApi")
public class InvestmentAreaActivity extends Activity {
    protected static final String AREA_ECONOMY_DEVELOPMENT="economy_development";
    protected static final String AREA_PHOTOVOLTAIC_INDUSTRY="photovoltaic";
    protected static final String AREA_SOUTH_NEW_INDUSTRY="south_new_industry";
    protected static final String AREA_LIGHT_INDUSTRY="light";
    protected static final String AREA_LINGTANG_PHOTOVOLTAIC_INDUSTRY="lingtang_photovoltaic";
    protected static final String AREA_LINGTANG_ELECTRONIC_LINE_INDUSTRY="electronic_line";
    
	private Integer[] mThumbIds = { R.drawable.investment_area_1,
			R.drawable.investment_area_2, R.drawable.investment_area_3,
			R.drawable.investment_area_4, R.drawable.investment_area_5,
			R.drawable.investment_area_6

	};

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_invesetment_area);
		ActionBar bar = this.getActionBar();
		bar.setTitle("");
		bar.setBackgroundDrawable(getResources().getDrawable(
				R.drawable.investment_area_header_bg));
		bar.setDisplayUseLogoEnabled(false);
		bar.setDisplayShowHomeEnabled(false);

		GridView gridview = (GridView) findViewById(R.id.investment_area);
		ImageAdapter imageAdapter = new ImageAdapter(this);
		imageAdapter.setmThumbIds(mThumbIds);
		gridview.setAdapter(imageAdapter);

		gridview.setOnItemClickListener(new OnItemClickListener() {
			public void onItemClick(AdapterView<?> parent, View v,
					int position, long id) {
				Intent intent = new Intent(InvestmentAreaActivity.this,AreaInfoActivity.class);
				switch (position) {
				
				case 0: {					
					intent.putExtra("area", AREA_ECONOMY_DEVELOPMENT);
				}

				case 1: {				
					intent.putExtra("area", AREA_ECONOMY_DEVELOPMENT);
				}
				case 2: {
					intent.putExtra("area", AREA_ECONOMY_DEVELOPMENT);
				}
				case 3: {
					intent.putExtra("area", AREA_ECONOMY_DEVELOPMENT);
				}
				case 4: {
					intent.putExtra("area", AREA_ECONOMY_DEVELOPMENT);
				}
				case 5: {
					intent.putExtra("area", AREA_ECONOMY_DEVELOPMENT);
				}
				}
				startActivity(intent);
			}
		});

	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.invesetment_area, menu);
		return true;
	}

}
